package com.abcd.kaixin.api.impl;

import java.util.List;

import com.abcd.kaixin.api.FriendOperations;
import org.springframework.web.client.RestTemplate;

public class FriendTemplate extends AbstractKaixinOperations implements FriendOperations{
	private final KaixinAPI api;

	private final RestTemplate restTemplate;
	
	public FriendTemplate(KaixinAPI api, boolean isAuthorizedForUser, RestTemplate restTemplate) {
		super(isAuthorizedForUser);
		this.api = api;
		this.restTemplate = restTemplate;
	}

	@Override
	public User getMyInfo(String fields) {

		requireAuthorization();
		User user = api.fetchObject("users/me.json", User.class);
		return user;
	}

	@Override
	public List<String> getFriendIds() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<User> getFriendLists() {
		// TODO Auto-generated method stub
		requireAuthorization();
		List<User> users = api.fetchConnections("friends", "me.json", User.class);
		return users;
	}
}
